<template>
	<view class="">
		<button type="default" @click="getWhere">获取经纬度</button>
		<view>{{ longitude }}</view>
		<view>{{ latitude }}</view>
		
		<button type="default" @click="showMap">获取经纬度后在地图中显示</button>
	</view>
</template>

<script>
export default {
	data() {
		return {
			longitude: '-',
			latitude: '-'
		};
	},
	methods: {
		getWhere() {
			let _this = this;
			uni.getLocation({
				type: 'gcj02',
				success: function(res) {
					_this.longitude = res.longitude;
					_this.latitude = res.latitude;
				}
			});
		},
		showMap(){
			console.log(1);
		}
	}
};
</script>

<style></style>
